package com.itheima.sh.order.controller;

import com.itheima.sh.pojo.Order;
import com.itheima.sh.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:
 * @Version: V1.0
 */
@RestController
@RequestMapping("order")
@RefreshScope
public class OrderController {

    @Autowired
    OrderService orderService;

    @GetMapping("findOrderByUsername")   // ?username=itcast
    public List<Order> findOrderByUsername( @RequestParam("username") String username) {
        return orderService.findOrderByUsername(username);
    }

}
